Skip to content

fix(security): optional SSRF egress guard for probes and webhooks - #49

Merged
ClaraVnk merged 1 commit into
mainfrom
feat/sec-ssrf-guard
Jun 30, 2026
Merged

fix(security): optional SSRF egress guard for probes and webhooks#49
ClaraVnk merged 1 commit into
mainfrom
feat/sec-ssrf-guard

Conversation

@ClaraVnk

Copy link
Copy Markdown
Contributor

Pentest remediation — finding #1 (SSRF). Opt-in (SSRF_BLOCK_PRIVATE, default off,
since monitoring legitimately reaches internal hosts).

  • assert_target_allowed(host) resolves DNS and, when enabled, blocks loopback /
    RFC1918 / link-local (incl. cloud metadata 169.254.169.254) / reserved / multicast.
  • Wired into all probe types (HTTP/TCP/SSL/PING/SNMP), the SNMP poller, and webhook
    delivery; the HTTP probe also disables redirect-following when the guard is on.
  • Default off → single-user self-hosted internal monitoring is unchanged.

Tests: IP classification, the toggle, and HTTP/webhook blocking. Full suite 235
passed
; ruff + mypy(strict) green.

Address the SSRF finding: an authenticated user can point a probe or webhook at
internal services or the cloud metadata endpoint. A monitoring tool legitimately
reaches internal hosts, so this is an opt-in guard (`SSRF_BLOCK_PRIVATE`, default
off) for multi-tenant deployments.

- app/core/security/ssrf.py: `assert_target_allowed(host)` resolves the host (DNS, so
  a name mapping to an internal IP is caught) and, when the guard is on, rejects
  loopback / RFC1918 / link-local (incl. 169.254.169.254) / reserved / multicast.
- All probe types (HTTP/TCP/SSL/PING/SNMP) and webhook delivery, plus the SNMP
  poller, check the target first; the HTTP probe also stops auto-following redirects
  when the guard is on (so a 30x can't bounce to an internal address).
- Default off → single-user self-hosted monitoring of internal hosts is unchanged.

Tests: internal-IP classification, the toggle (off allows, on blocks internal /
allows public), and HTTP-probe + webhook blocking when enabled. Full suite 235
passed; ruff + mypy(strict) green.
@ClaraVnk
ClaraVnk merged commit 031fb9c into main Jun 30, 2026
4 checks passed
@ClaraVnk
ClaraVnk deleted the feat/sec-ssrf-guard branch June 30, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant